//
//  StatusCellButtomView.swift
//  glzbowei
//
//  Created by 高伦展 on 2018/1/7.
//  Copyright © 2018年 glz. All rights reserved.
//

import UIKit
import SnapKit

class StatusCellButtomView: UIView {

     //MAKR:-构造函数
    override init(frame: CGRect) {
        super.init(frame:frame)
        
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //MAKR:-懒加载控件
    //转发按钮
    private lazy var retweeteButton:UIButton = UIButton(title: " 转发", fontSize: 12, color: UIColor.darkGray, imgName: "timeline_icon_retweet")
    //评论按钮
     private lazy var commentButton:UIButton = UIButton(title: " 评论"
        , fontSize: 12, color: UIColor.darkGray, imgName: "timeline_icon_comment")
    //点赞按钮
     private lazy var likeButton:UIButton = UIButton(title: " 赞", fontSize: 12, color: UIColor.darkGray, imgName: "timeline_icon_unlike")
}

extension StatusCellButtomView{
    
    private func setupUI(){
          backgroundColor = UIColor(white: 0.9, alpha: 0.5)
        
        //1.添加控件
        addSubview(retweeteButton)
        addSubview(commentButton)
        addSubview(likeButton)
        
        retweeteButton.snp.makeConstraints { (make) in
            make.left.equalTo(self.snp.left)
            make.top.equalTo(self.snp.top)
            make.bottom.equalTo(self.snp.bottom)
        }
        
        commentButton.snp.makeConstraints { (make) in
            make.left.equalTo(retweeteButton.snp.right)
            make.top.equalTo(self.snp.top)
            make.height.equalTo(retweeteButton.snp.height)
            make.width.equalTo(retweeteButton.snp.width)
        }
        
        likeButton.snp.makeConstraints { (make) in
            make.left.equalTo(commentButton.snp.right)
            make.top.equalTo(self.snp.top)
            make.height.equalTo(commentButton.snp.height)
            make.width.equalTo(commentButton.snp.width)
            make.right.equalTo(self.snp.right)
        }
        
        let sep1 = sepView()
        let sep2 = sepView()
        
        addSubview(sep1)
        addSubview(sep2)
        
        let w = 0.5
        let scale = 0.4
        
        sep1.snp.makeConstraints { (make) in
            make.left.equalTo(retweeteButton.snp.right)
            make.centerY.equalTo(retweeteButton.snp.centerY)
            make.width.equalTo(w)
            make.height.equalTo(retweeteButton.snp.height).multipliedBy(scale)
        }
        
        sep2.snp.makeConstraints { (make) in
            make.left.equalTo(commentButton.snp.right)
            make.centerY.equalTo(commentButton.snp.centerY)
            make.width.equalTo(w)
            make.height.equalTo(commentButton.snp.height).multipliedBy(scale)
        }
        
    }
    
    private func sepView() -> UIView {
        let v = UIView()
        
        v.backgroundColor = UIColor.darkGray
        
        return v
    }
}
